package com.img.test;

import javax.swing.JFrame;
import java.awt.Color;

public class ImageJframe extends JFrame{
	private ImagePanel imagePanel;
	private ImagePanel imagePanel_1;
	private ImagePanel imagePanel_2;
	
	
public ImageJframe() {
	getContentPane().setBackground(Color.WHITE);

	getContentPane().setLayout(null);
	
	imagePanel = new ImagePanel();
	imagePanel.setBackground(Color.WHITE);
	imagePanel.setBounds(149, 86, 64, 64);
	getContentPane().add(imagePanel);
	
	imagePanel_1 = new ImagePanel();
	imagePanel_1.setBackground(Color.WHITE);
	imagePanel_1.setBounds(204, 141, 64, 64);
	getContentPane().add(imagePanel_1);
	
	imagePanel_2 = new ImagePanel();
	imagePanel_2.setBackground(Color.WHITE);
	imagePanel_2.setBounds(89, 141, 64, 64);
	getContentPane().add(imagePanel_2);
	
	setSize(500, 500);
	
	
	
	

setDefaultCloseOperation(3);

setVisible(true);

	reflushImage();

}

private void reflushImage() {

	
	new Thread(new Runnable() {
		
		@Override
		public void run() {
			
			int i =0;
			while(true){
				
				
				
				imagePanel.setXuanzhuan(i);
				imagePanel.repaint();
				imagePanel_1.setXuanzhuan(i);
				imagePanel_1.repaint();
				imagePanel_2.setXuanzhuan(i);
				imagePanel_2.repaint();
		
				
				i = i+20;
				
				
				if(i>360){
					i =0;
					
				}
				
				try {
					Thread.sleep(50);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}).start();
	
}

public static void main(String[] args) {
	new ImageJframe();
}
}
